<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 老猫 <thinkcmf@126.com>
// +----------------------------------------------------------------------
namespace app\portal\controller;

use cmf\controller\HomeBaseController;
use think\Db;
class DownloadController extends HomeBaseController
{
    //资料下载列表
    public function downloadList(){
        $language = $this->request->param('language');
        if(isset($language) && !empty($language)){
            //英文
            $field_contact = 'id,title_en,file_url';
        }else{
            //中文
            $field_contact = 'id,title,file_url';
        }
        $res = Db::name('download')
            ->field($field_contact)
            ->order('id desc')
            ->paginate(CommonController::limit,false,['query'=>request()->param()]);
        $data = $res->toArray();
        $data = $data['data'];
        $page = $res->render();

        $this->assign('list',$data);
        $this->assign('page',$page);

        return $this->fetch();
    }
}
